package com.punai.customer.mapper;

import com.punai.common.core.mapper.CommonMapper;
import com.punai.customer.domain.CusFbChapter;
import com.punai.customer.domain.vo.CusAllVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 分包费用项章节Mapper接口
 *
 * @author ruoyi
 * @date 2022-12-09
 */
public interface CusFbChapterMapper extends CommonMapper<CusFbChapter>
{
    /**
     * 查询分包费用项章节
     *
     * @param id 分包费用项章节主键
     * @return 分包费用项章节
     */
    public CusFbChapter selectDmcFbChapterById(String id);

    /**
     * 查询分包费用项章节列表
     *
     * @param dmcFbChapter 分包费用项章节
     * @return 分包费用项章节集合
     */
    public List<CusFbChapter> selectDmcFbChapterList(CusFbChapter dmcFbChapter);


    /**
     * 删除分包费用项章节
     *
     * @param id 分包费用项章节主键
     * @return 结果
     */
    public int deleteDmcFbChapterById(String id);

    /**
     * 批量删除分包费用项章节
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteDmcFbChapterByIds(String[] ids);

    Integer maxOrderNum(@Param("pid") String pid, @Param("companyId") Long companyId);

    void orderNumProcess(@Param("companyId") Long companyId, @Param("pid") String pid,
                         @Param("orderNum") Integer orderNum,@Param("num") int num);

    void orderNumProcessStartEnd(@Param("companyId")Long companyId,@Param("pid")  String pid,
                                 @Param("startNum")int startNum, @Param("endNum") int endNum,
                                 @Param("num") int num);

    List<CusFbChapter> selectChildrenById(@Param("id") String id, @Param("companyId") Long companyId);

    List<String> selectChildrenIdById(@Param("id") String id, @Param("companyId") Long companyId);

    void updateChildrenPids(@Param("childrenList") List<CusFbChapter> children, @Param("companyId")Long companyId);

    String getChildMaxLengthPids(@Param("id") String id, @Param("companyId") Long companyId);

    List<String> getOptionalSpecList(@Param("companyId") Long companyId);

    public List<CusFbChapter> queryContrast(@Param("companyId")Long companyId, @Param("ids") String[] ids);

    List<CusFbChapter> selectListByTopId(@Param("topId") String topId, @Param("companyId") Long companyId);
//    select * from cus_fb_chapter where company_id = #{companyId}  and (find_in_set(#{topId}, pids) or id = #{topId})

    public List<CusAllVo> countNode(@Param("companyId")Long companyId);
}
